#pragma once

#include <string>

class Config {
public:
    static Config& get_instance();

    static void load_config(const std::string& config_path);
    
    // 服务器配置
    const std::string& get_server_address() const { return server_address_; }
    unsigned short get_server_port() const { return server_port_; }
    
    // MySQL配置
    const std::string& get_mysql_host() const { return mysql_host_; }
    const std::string& get_mysql_user() const { return mysql_user_; }
    const std::string& get_mysql_password() const { return mysql_password_; }
    const std::string& get_mysql_database() const { return mysql_database_; }
    int get_mysql_port() const { return mysql_port_; }

    size_t get_mysql_pool_initial_size() const { return mysql_pool_initial_size_; }
    size_t get_mysql_pool_max_size() const { return mysql_pool_max_size_; }
    size_t get_mysql_pool_max_idle_time() const { return mysql_pool_max_idle_time_; }
    size_t get_mysql_pool_connection_timeout() const { return mysql_pool_connection_timeout_; }

    // Redis配置
    const std::string& get_redis_host() const { return redis_host_; }
    int get_redis_port() const { return redis_port_; }

    size_t get_redis_pool_initial_size() const { return redis_pool_initial_size_; }
    size_t get_redis_pool_max_size() const { return redis_pool_max_size_; }
    size_t get_redis_pool_max_idle_time() const { return redis_pool_max_idle_time_; }
    size_t get_redis_pool_connection_timeout() const { return redis_pool_connection_timeout_; }

private:
    Config() = default;
    
    // 服务器配置
    std::string server_address_;
    unsigned short server_port_;
    
    // MySQL配置
    std::string mysql_host_ = "localhost";
    std::string mysql_user_ = "app_user";
    std::string mysql_password_ = "Aa123456#";
    std::string mysql_database_ = "test_db";
    int mysql_port_ = 3306;

    size_t mysql_pool_initial_size_ = 10;
    size_t mysql_pool_max_size_ = 100;
    size_t mysql_pool_max_idle_time_ = 300;
    size_t mysql_pool_connection_timeout_ = 10;

    // Redis配置
    std::string redis_host_ = "127.0.0.1";
    int redis_port_ = 6379;

    size_t redis_pool_initial_size_ = 10;
    size_t redis_pool_max_size_ = 100;
    size_t redis_pool_max_idle_time_ = 300;
    size_t redis_pool_connection_timeout_ = 10;
}; 